import sys

from PyQt5.QtCore import Qt
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel, QLineEdit, QPushButton, QMessageBox, QFrame

'''
控件快捷键： &x 设置快捷建 alt+x 绑定兄弟控件lbname.setBuddy(leName) 
超链接
lb_bc = QLabel(self)
lb_bc.setText('<a href="http://bcczcs.com">编程创造城市</a>')
lb_bc.move(120, 150)
lb_bc.setOpenExternalLinks(True)
'''


class MyClass(QMainWindow):
    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        self.setWindowTitle('刘金玉编程教程')
        self.setWindowIcon(QIcon('./img/msn.ico'))
        self.setGeometry(800, 370, 400, 300)

        lbname = QLabel(self)
        lbname.setText('姓名(&x):')  # &x 设置快捷建 alt+x, 为 lbname.setBuddy(leName) 准备快捷键绑定
        lbname.move(50, 50)

        leName = QLineEdit(self)
        leName.move(100, 50)
        lbname.setBuddy(leName)  # 兄弟控件绑定

        lbDream = QLabel(self)
        lbDream.setText('愿望(&2):')  # &x 设置快捷建 alt+x
        lbDream.move(50, 100)

        leDream = QLineEdit(self)
        leDream.move(100, 100)
        lbDream.setBuddy(leDream)

        lb_bc = QLabel(self)
        lb_bc.setText('<a href="http://bcczcs.com">编程创造城市</a>')
        lb_bc.move(120, 150)
        lb_bc.setOpenExternalLinks(True)

        self.show()

    def myDo(self):
        pass


if __name__ == '__main__':
    app = QApplication(sys.argv)
    myf = MyClass()
    app.exec_()
